﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace GetSmartIDEList.Lib.ORM
{
    [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = false)]
    public class FieldAttribute : Attribute
    {
        private string _Fields;
        /// <summary>
        /// 字段名称
        /// </summary>
        public string Fields
        {
            get { return _Fields; }
        }

        private DbType _Dbtype;
        /// <summary>
        /// 字段类型
        /// </summary>
        public DbType Dbtype
        {
            get { return _Dbtype; }
        }

        private int _ValueLength;
        /// <summary>
        /// 字段值长度
        /// </summary>
        public int ValueLength
        {
            get { return _ValueLength; }
        }

        private bool _PK_Primary;
        /// <summary>
        /// 是否是主键
        /// </summary>
        public bool PK_Primary
        {
            get { return _PK_Primary; }
        }

        private bool _isIgnore;

        /// <summary>
        /// 是否忽略列
        /// </summary>
        public bool IsIgnore
        {
            get { return _isIgnore; }
        }

        public FieldAttribute() { }
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="fields"> 字段名</param>
        /// <param name="types"> 字段类型</param>
        /// <param name="i"> 字段值长度</param>
        /// <param name="IsIgnore">是否忽略</param>
        public FieldAttribute(string fields, DbType types, int i, bool PK = false, bool IsIgnore = false)
        {
            _Fields = fields;
            _Dbtype = types;
            _PK_Primary = PK;
            _ValueLength = i;
            _isIgnore = IsIgnore;
        }
    }
}
